package com.ymatou.iapi.prodstock.service;

import java.util.List;

import com.google.common.reflect.TypeToken;
import com.ymatou.iapi.prodstock.parameter.CancelActivityResult;
import com.ymatou.iapi.prodstock.parameter.ModifyResult;
import com.ymt.base.YmatouBaseCall;
import com.ymt.core.tool.FormatUtil;
import com.ymttest.utils.EnvSetup;
/**
*返还活动库存Call
*FreeMaker Template自动生成代码
*/
public class ReturnProductActivityStockCall extends YmatouBaseCall{
	private static String opurl ="api/Product/ReturnProductActivityStock";
	
	public ReturnProductActivityStockCall() {
		super(EnvSetup.getSystemUrl("prodstock"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	
	public List<CancelActivityResult> getBatchCancelResults(){
		String sBatchCancelResults=getJsonObject().get("Data").getAsJsonObject().get("BatchCancelResults").getAsJsonArray().toString();
		List<CancelActivityResult> BatchCancelResults=(List<CancelActivityResult>)FormatUtil.GSONToObject(sBatchCancelResults, new TypeToken<List<CancelActivityResult>>(){}.getType());
		return BatchCancelResults;
	}
}